<?php
	require_once '../include/common.inc.php';
	$uid = $_SESSION['login_uid'];
	$username = $_SESSION['login_user'];
	if(!check_auth('rebots_msg') && !check_auth('room_admin')) {
		echo "<script>alert('没有权限');</script>";
		header("location:/user/");exit();
	}

	switch($act){
		case "robots_del":
			if(is_array($id)) {
				$ids = implode(',',$id);
				if($ids=="")return;
				$db->query("delete from {$tablepre}rebotslist where id in ($ids)");
			} else {
				if($id=="")return;
				$db->query("delete from {$tablepre}rebotslist where id in ($id)");
			}
			header("location:" . $_SERVER['HTTP_REFERER']);
		break;
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>假人管理</title>
<link href="style/css.css" rel="stylesheet" type="text/css" />
<script src="../script/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<style>
.button {
  display: inline-block;
  *display: inline;
  /* IE7 inline-block hack */
  *zoom: 1;
  margin-bottom: 0;
  font-weight: normal;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  background-image: none;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 20px;
  padding: 4px 12px;
  font-size: 14px;
  border-radius: 4px;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  color: #333333;
  background-color: #ffffff;
  border-color: #cccccc;
}
.button-success {
    color: rgb(255, 255, 255);
    background-color: rgb(92, 184, 92);
    border-color: rgb(76, 174, 76);
}

.button-danger {
    color: rgb(255, 255, 255);
    background-color: rgb(217, 83, 79);
    border-color: rgb(212, 63, 58);
}
</style>
</head>
	<script>
		Date.prototype.Format = function (fmt) { //author: meizz
			var o = {
				"M+": this.getMonth() + 1, //月份
				"d+": this.getDate(), //日
				"h+": this.getHours(), //小时
				"m+": this.getMinutes(), //分
				"s+": this.getSeconds(), //秒
				"q+": Math.floor((this.getMonth() + 3) / 3), //季度
				"S": this.getMilliseconds() //毫秒
			};
			if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
			for (var k in o)
				if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
			return fmt;
		}
		function ftime(time) {
			return new Date(time * 1000).Format("yyyy-MM-dd hh:mm");
			;
		}
		function sgid(id) {
			var arr = new Array();
			if (isNaN(id)) return '';
			<?php
		 $query=$db->query("select * from {$tablepre}auth_group order by id desc"); while($row=$db->fetch_row($query)){ echo "arr['{$row[id]}']='$row[title]';"; } ?>
			return arr[id];
		}
	</script>
<body style="background:#ededed">
	<?php 
include_once 'head.php'; 
?>
	<div id="sidebar" class="sidebar-fixed" >
        <?php include_once 'left.php';?>
     </div>
     
     <div id="content">
     	<div class="container">
        	<div class="crumbs">
            	<a href="#">首页</a>><a href="#">假人管理</a>
          </div>
          <div class="biaoge">  
            <div class="result-wrap">
           <form class="form-horizontal" action="" method="get">
  <ul class="breadcrumb" style="margin-bottom:10px;">
    <li class="active">
      <button type="button" class="button  button-danger" onclick="if(confirm('确定删除？'))$('#hd_list').submit()">删除所选</button>
      <button type="button" class="button  button-success" onclick="location.href='robot_add.php'">添加用户</button></li>
  </ul>
  </form> 
  <form action="" method="POST" enctype="application/x-www-form-urlencoded"  class="form-horizontal" id="hd_list">
	<input type="hidden" name="gid" value="">
	<input type="hidden" name="act" value="robots_del">
                <div class="result-content">
                    <table class="result-tab" width="100%">
                        <tbody><tr>
                       		<th width="19" align="center" bgcolor="#FFFFFF"><input type="checkbox" onClick="$('.ids').attr('checked',this.checked); "></th>
                            <th width="50">序号</th>
                            <th>昵称</th>
                            <th>用户组</th>
                            <th>归属</th>
                            <th>上线星期</th>
                            <th>上线时间</th>
                            <th>下线时间</th>
                            <th>所属房间</th>
                            <th>操作</th>
                        </tr>
<?php
echo userrobot(20,$username,'
 <tr>
 	<td><input type="checkbox" class="ids" name="id[]" value="{id}"></td>
 	 <td >{id}</td>
     <td >{name}</td>
	 <td><script>document.write(sgid({rgroup})); </script></td>
  	 <td>{fuser}</td>
	 <td>{week}</td>
	 <td>{stime}</td>
	 <td>{etime}</td>
	 <td>{rid}</td>
	 <td><button type="button" class="button button-mini button-info" onClick="location.href=\'robot_edit.php?id={id}\'" ><i class="x-icon x-icon-small icon-wrench icon-white"></i>修改</button>
		<button type="button" class="button button-mini button-danger" onclick="if(confirm(\'确定删除用户？\'))location.href=\'?act=robots_del&id={id}\'">
		<i class="x-icon x-icon-small icon-trash icon-white"></i>删除
		</button></td>
 </tr>
')
?>

                  </tbody></table>
                    </div>
                    </form>
              <ul class="breadcrumb">
		<li class="active"><?= $pagenav ?>
		</li>
	</ul
        ></div>
                	
                
          </div>
        </div>
     </div>
</body>
</html>